import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'

// 必须使用动态导入方式加载可选插件
const vueDevTools = await import('vite-plugin-vue-devtools').then(m => m.default)

export default defineConfig({
  plugins: [
    vue(),
    vueDevTools()
  ],
  server: {
    host: '0.0.0.0',
    port: 9000,
    proxy: {
      '/scholarship': {
        target: 'http://localhost:8800',
        changeOrigin: true
      },
      '/user': {
        target: 'http://localhost:8800',
        changeOrigin: true
      },
      '/grade': {
        target: 'http://localhost:8800',
        changeOrigin: true
      },
      '/competitionCatalog': {
        target: 'http://localhost:8800',
        changeOrigin: true
      },
      '/competitionParticipation': {
        target: 'http://localhost:8800',
        changeOrigin: true
      },
      '/intellectualProperty': {
        target: 'http://localhost:8800',
        changeOrigin: true
      },
      '/ipScoringRule': {
        target: 'http://localhost:8800',
        changeOrigin: true
      },
      '/paperScoringRule': {
        target: 'http://localhost:8800',
        changeOrigin: true
      },
      '/socialService': {
        target: 'http://localhost:8800',
        changeOrigin: true
      },
      '/socialServiceRule': {
        target: 'http://localhost:8800',
        changeOrigin: true
      },
      '/researchPaper': {
        target: 'http://localhost:8800',
        changeOrigin: true
      },
      '/political': {
        target: 'http://localhost:8800',
        changeOrigin: true
      }
    }
  },
  build: {
    outDir: 'dist',
    assetsDir: 'assets',
    sourcemap: false
  }
}) 